#!/bin/bash

# ----------------------------------------------------------------------
# Filename:   75332-nfs.sh
# Version:    1.0
# Date:       2013/11/15
# Author:     yuanhui.shi
# Email:      yuanhui.shi@cs2c.com.cn
# Summary:    02系统基本功能-04网络服务-05NFS-01字符模式-01服务控制
# Notes:       nfs service start/status/stop/restart
# Copyright:    China Standard Software Co., Ltd.
# History：     
#             Version 1.0, 2013/11/14
#             -   The first one
# ----------------------------------------------------------------------

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH

source ../../../lib/Echo.sh
source ./lib/cmd.sh
source ../../../lib/XmlParse.sh

function CleanData ()
{
  EchoInfo "关闭服务器端的nfs服务"
  stop_daemon ${serv}
  EchoInfo "75332-nfs.sh执行完毕"
}

trap "CleanData" EXIT INT

#Set environment
serv=nfs
stop_daemon ${serv}
status_daemon ${serv}

# Start nfs service
if [ $? -ne 0 ]
then
     start_daemon ${serv}
     EchoResult "service ${serv} start"    
fi 

sleep 5

#Get status about nfs service
status_daemon ${serv}
EchoResult "service ${serv} status"

sleep 5

# restart nfs service 
restart_daemon ${serv}
EchoResult "service ${serv} restart"


sleep 5

# stop nfs service
stop_daemon ${serv}
EchoResult "service ${serv} stop"

EchoResult "testcase: ${serv} start,stop,restart"
